import { FC } from 'react';
import { useRouteError,useNavigate } from 'react-router-dom';
import { UnauthorizedException } from '@/service/http/errors/unauthorized';


const GlobalErrorBoundary: FC = () => {
  const error = useRouteError();
  const navigate = useNavigate();
  if (error instanceof UnauthorizedException) {
    console.log(error)
    navigate('/login');
    // return (window.location.href = `${getJumpUrl()}/#/user/login?redirectUrl=${window.location.href}`);
  }

  return <></>;
};

export default GlobalErrorBoundary;
